package com.wshare.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

import com.fasterxml.jackson.annotation.JsonBackReference;

@Entity
@Table(name = "permission")
public class Permission {
	
	@Id
	@GenericGenerator(name="increment" , strategy="increment")
	@GeneratedValue(generator="increment")
	@Column(name= "per_id")
	private int perId;
	
	@Column(name = "per_name")
	private String perName;
	
	@ManyToMany(mappedBy = "lPermissions")
	@JsonBackReference
	private List<Role> lRoles;

	public Permission() {
	}

	public Permission(int perId, String perName, List<Role> lRoles) {
		this.perId = perId;
		this.perName = perName;
		this.lRoles = lRoles;
	}

	public int getPerId() {
		return perId;
	}

	public void setPerId(int perId) {
		this.perId = perId;
	}

	public String getPerName() {
		return perName;
	}

	public void setPerName(String perName) {
		this.perName = perName;
	}

	public List<Role> getlRoles() {
		return lRoles;
	}

	public void setlRoles(List<Role> lRoles) {
		this.lRoles = lRoles;
	}
	
	
	
}